#include<bits/stdc++.h>

using namespace std;

void remove(string &s) {
    if (s.size() == 1) {
        s = "0";
        return;
    };
    for (int i = 1; i < s.length(); i++) {
        if (s[i] < s[i - 1]) {
            s.erase(s.begin() + i - 1);
            return;
        }
    }
    s.erase(s.end() - 1);
    return;
}

int main() {
    string s;
    int k;
    cin >> s >> k;
    while (k--) {
        remove(s);
    }
    while (s.size() > 1 && s[0] == '0') {
        s.erase(s.begin());
    }
    cout << s << endl;
    return 0;
}
